<%@ page contentType="text/html;charset=UTF-8"%>
<!-- <script type="text/javascript">
// $(document).ready(function (){
// 	$('#updatePwdModal').on('shown.bs.modal', function (e){
// 		alert("==")
// 		$("#oldPassword").val("");
// 		$("#newPassword").val("");
// 		$("#newPassword2").val("");
// 		$("#msg").html("");
// 	})
// });
</script> -->
<div class="modal fade" id="updatePwdModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog" style="width:420px;height: 300px;">
    <div class="modal-content modal_1">
      <div class="modal-header modal_2">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h5 class="modal-title Grey" id="myModalLabel"><span class="glyphicon glyphicon-ok Blue margin_1"></span>修改密码</h5>
      </div>
	      <div class="modal-body">
	      	<table  border="0" align="center">
			    <tr>
			      <td height="37" align="center" valign="middle">
			      		<div align="right"> 原密码：</div>
			      </td>
			      <td>
				        <label>
				           <input type="password"  id="oldPassword" name="oldPassword" class="form-control" placeholder="原密码" required >
				        </label>
			      </td>
			    </tr>
			    <tr>
			      <td height="37" align="center" valign="middle">
			      		<div align="right">新密码：</div>
			      </td>
			      <td>
				        <label>
				         <input type="password"  id="newPassword" name="newPassword" class="form-control" placeholder="新密码" required >
				        </label>
			      </td>
			     </tr>
			     <tr>
			      <td height="37" align="center" valign="middle">
			      		<div align="right"> 重复新密码：</div>
			      </td>
			      <td>
				        <label>
				           <input type="password" id="newPassword2" name="newPassword2" class="form-control" placeholder="重复新密码" required >
				        </label>
			      </td>
			    </tr>
			    <tr><td colspan="2"><div class="login_text_2" id="msg"></div></td></tr>
			</table>
	     </div>
	      <div class="modal-footer modal_3">
	        <button type="button" onclick="updatePwdSubmit('${contextPath}/sys/org/updatePassword')"   class="btn btn-danger btn_5">确认修改</button>
	      </div>
       <script type="text/javascript">
		function updatePwdSubmit(url)
		{ 
			var oldPassword = $("#oldPassword").val();
			var newPassword = $("#newPassword").val();
			var newPassword2 = $("#newPassword2").val();
			if(oldPassword == null || oldPassword.length < 1)
			{ 
				$("#msg").html("请输入原密码！");
				return;
			}else{$("#msg").html("");}
			if(newPassword == null || newPassword.length < 1)
			{
				$("#msg").html("输入您的新密码！");
				return;
			}else{$("#msg").html("");}
			
			if(newPassword != newPassword2)
			{
				$("#msg").html("两次密码不一致！");
				return;
			}else{$("#msg").html("");}
			
			$.ajax({
				   type: "POST",
				   url: url,
				   data: "oldPassword="+oldPassword+"&newPassword="+newPassword,
				   success: function(textv){
					   var jsonObj = eval('(' + textv + ')');
					  // if("S"==jsonObj.returnVal)
						$("#msg").html(jsonObj.msg);
				   }
			});
			
		}
        </script>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->